package cn.mes.module.mes.dal.mysql.baseworkshop;

import java.util.*;

import cn.mes.framework.common.pojo.PageResult;
import cn.mes.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.mes.framework.mybatis.core.mapper.BaseMapperX;
import cn.mes.module.mes.dal.dataobject.baseworkshop.BaseWorkShopDO;
import org.apache.ibatis.annotations.Mapper;
import cn.mes.module.mes.controller.admin.baseworkshop.vo.*;

/**
 * 车间信息 Mapper
 *
 * @author 游创
 */
@Mapper
public interface BaseWorkShopMapper extends BaseMapperX<BaseWorkShopDO> {

    default PageResult<BaseWorkShopDO> selectPage(BaseWorkShopPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BaseWorkShopDO>()
                .eqIfPresent(BaseWorkShopDO::getWorkShopCode, reqVO.getWorkShopCode())
                .likeIfPresent(BaseWorkShopDO::getWorkShopName, reqVO.getWorkShopName())
                .eqIfPresent(BaseWorkShopDO::getWorkShopUse, reqVO.getWorkShopUse())
                .eqIfPresent(BaseWorkShopDO::getNote, reqVO.getNote())
                .eqIfPresent(BaseWorkShopDO::getStatus, reqVO.getStatus())
                .orderByDesc(BaseWorkShopDO::getId));
    }


    default List<BaseWorkShopDO> selectList(WorkShopListReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<BaseWorkShopDO>()
                .likeIfPresent(BaseWorkShopDO::getWorkShopName, reqVO.getName())
                .eqIfPresent(BaseWorkShopDO::getStatus, reqVO.getStatus()));
    }

}